<?php

/**
 * Description of Employee
 *
 * @author Dagvadorj Galbadrakh <dagvadorj@interactive.mn>
 */
class Employee extends Interactive\Reference\Base {

    public $id; 
    public $firstName, $lastName, $birthDate;

    function __construct($id, $firstName, $lastName, \DateTime $birthDate) {

        $this->id = $id; 
        $this->firstName = $firstName;
        $this->lastName = $lastName;
        $this->birthDate = $birthDate;
    }

    private function getAge() { 
        return $this->birthDate->diff(new \DateTime())->format("%y"); 
    } 

    public function id() { 
        return $this->id; 
    } 

    public function createView() {
        
    }

    public function editView() {
        return array(
            array("header" => "First name", "name" => "firstName", "value" => $this->firstName),
            array("header" => "Last name", "name" => "lastName", "value" => $this->lastName)
            );
    }

    public function listView() {
        return array(
            array("header" => "First name", "value" => $this->firstName),
            array("header" => "Last name", "value" => $this->lastName),
            array("header" => "Age", "value" => $this->getAge()), 
            array("header" => "Age", "value" => "Boo")
            );
    }

    public function view() {
        
    }

    public function edit() { 
        // Interactive\Common\Logging::stdout("do"); 
        // file_put_contents("dd.txt", "dd");
        print "dfdf"; 
    }
}

?>
